package com.yangye.springclouddemorabbitmq.consumer;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author yangye
 * @date 2020/08/19
 */
@Component
@Slf4j
public class MsgListener {

	@RabbitListener(queues = "yangye-direct-queue")
	public void consumeMsg(Message message, Channel channel) {
		log.info("消费到普通消息：" + new String(message.getBody()));
	}

	@RabbitListener(queues = "dlx-queue")
	public void consumeDelayMsg(Message message, Channel channel) {
		log.info("这是一条延迟消息：" + new String(message.getBody()));
	}
}
